<template>
  <div>
    <date
      v-model="valueTime"
      :type.sync="groupType"
      @handleChangeTime="handleChangeTime($event)"
    ></date>
  </div>
</template>
<script>
import {
  listBiVueParamDwd,
  getBiVueParamDwd,
  delBiVueParamDwd,
  addBiVueParamDwd,
  updateBiVueParamDwd,
  updateParam,
} from "@/api/vue/BiVueParamDwd";
import date from "@/views/vue/Ui/common/date.vue";
import { listBrandChannelShop, listAll } from "@/api/chart/brandChannelShop";
export default {
  components: {
    date,
  },
  data() {
    return {
      //时间控件
      valueTime: new Date(new Date().setDate(new Date().getDate() - 1)),
      groupType: "date",
      //时间控件
      timeObj: {},
    };
  },
  created() {},
  methods: {
    //选完时间后发请求
    handleChangeTime(timeObj) {
      // console.log(type)
      // console.log(timeObj)
      // TODO
      this.timeObj = timeObj;
      console.log(JSON.stringify(this.timeObj));
      let obj = {
        path: "day",
        query: {},
      };
      if (!this.timeObj.endTime) {
        return;
      } else {
        obj.query.startDate = this.timeObj.startTime;
        obj.query.endDate = this.timeObj.endTime;
        obj.query.dateType = this.timeObj.dateType;
      }
      updateParam(obj).then((response) => {
        if (!response.data) {
          return;
        }
        if (response.data.length > 0) {
          // this.$modal.msgSuccess("有列表返回");
          this.$emit("handleChangelistAll", response.data);
        } else {
          // this.$modal.msgError("没有列表");
        }
      });
    },
  },
};
</script>